!function () {
  if(!window.wx){
    return;
  }
  if (GameGlobal.mg = GameGlobal.mg || {}, mg.env = {
    USER_DATA_PATH: wx.env.USER_DATA_PATH
  }, mg.gameLoadResult = function () {
    mg.onGameLoadResult && mg.onGameLoadResult();
  }, mg.getSystemInfoSync = wx.getSystemInfoSync, mg.getChannel = function () {
    return "微信小游戏";
  }, mg.getUpdateManager = wx.getUpdateManager, mg.onShow = wx.onShow, mg.onHide = wx.onHide, mg.offShow = wx.offShow, mg.offHide = wx.offHide, mg.getLaunchOptionsSync = wx.getLaunchOptionsSync, mg.triggerGC = wx.triggerGC, mg.getRealtimeLogManager = wx.getRealtimeLogManager, mg.restartGame = wx.restartMiniProgram, mg.showShareMenu = wx.showShareMenu, mg.shareAppMessage = wx.shareAppMessage, mg.onShareAppMessage = wx.onShareAppMessage, mg.showModal = wx.showModal, mg.getMenuButtonRect = wx.getMenuButtonBoundingClientRect, mg.pay = wx.requestMidasPayment, mg.setStorageSync = wx.setStorageSync, mg.setStorage = wx.setStorage, mg.getStorageSync = wx.getStorageSync, mg.getStorage = wx.getStorage, mg.removeStorageSync = wx.removeStorageSync, mg.clearStorageSync = wx.clearStorageSync, mg.onEvent = wx.reportEvent, mg.getFileSystemManager = wx.getFileSystemManager, mg.getUserInfo = wx.getUserInfo, mg.createUserInfoButton = wx.createUserInfoButton, mg.login = function (e) {
    wx.login({
      force: e.force || !1,
      success: function (t) {
        t.pf = "wx", e.success(t);
      },
      fail: e.fail,
      complete: e.complete
    });
  }, mg.setUserCloudStorage = function (e) {
    for (var t = e.KVDataList, n = 0; n < t.length; n++) {
      var a = t[n];
      a.value.mggame && (a.value.wxgame = a.value.mggame, delete a.value.mggame), a.value = JSON.stringify(a.value);
    }
    wx.setUserCloudStorage(e);
  }, mg.getOpenDataContext = wx.getOpenDataContext, mg.openCustomerServiceConversation = wx.openCustomerServiceConversation, mg.openSetting = wx.openSetting, mg.getSetting = wx.getSetting, mg.getAccountInfoSync = wx.getAccountInfoSync, mg.requirePrivacyAuthorize = wx.requirePrivacyAuthorize, mg.requestSubscribeSystemMessage = wx.requestSubscribeSystemMessage, mg.showKeyboard = wx.showKeyboard, mg.updateKeyboard = wx.updateKeyboard, mg.hideKeyboard = wx.hideKeyboard, mg.onKeyboardComplete = wx.onKeyboardComplete, mg.onKeyboardConfirm = wx.onKeyboardConfirm, mg.offKeyboardComplete = wx.offKeyboardComplete, mg.offKeyboardConfirm = wx.offKeyboardConfirm, mg.setClipboardData = wx.setClipboardData, mg.setKeepScreenOn = wx.setKeepScreenOn, mg.onMemoryWarning = wx.onMemoryWarning, mg.vibrateShort = wx.vibrateShort, mg.vibrateLong = wx.vibrateLong, mg.createWorker = wx.createWorker, wx.getGameRecorder) {
    var e = function () {
        var e = this,
          t = wx.getGameRecorder();
        t.on("start", function () {
          e._startCallback && e._startCallback();
        }), t.on("stop", function (t) {
          e._stopCallback && e._stopCallback({
            videoPath: t.videoID
          });
        }), t.on("error", function (t) {
          e._errorCallback && e._errorCallback({
            errCode: t && t.code || -1,
            errMsg: t && t.message || ""
          });
        }), this.start = function () {
          t.start();
        }, this.stop = function () {
          t.stop();
        }, this.onStart = function (t) {
          e._startCallback = t;
        }, this.onStop = function (t) {
          e._stopCallback = t;
        }, this.onError = function (t) {
          e._errorCallback = t;
        };
      },
      t = null;
    mg.getGameRecorderManager = function () {
      return null == t && (t = new e()), t;
    };
  }
  mg.createBannerAd = function (e) {
    return null == e || null == e.adUnitId || "" == e.adUnitId ? null : wx.createBannerAd(e);
  }, mg.createInterstitialAd = function (e) {
    return null == e || null == e.adUnitId || "" == e.adUnitId ? null : wx.createInterstitialAd({
      adUnitId: e.adUnitId
    });
  }, mg.createRewardedVideoAd = function (e) {
    return null == e || null == e.adUnitId || "" == e.adUnitId ? null : wx.createRewardedVideoAd({
      adUnitId: e.adUnitId
    });
  }, wx.createCustomAd && (mg.createCustomAd = function (e) {
    return null == e || null == e.adUnitId || "" == e.adUnitId ? null : wx.createCustomAd(e);
  }), mg.checkScene = function (e) {
    e.success({
      isExist: !0
    });
  }, Object.defineProperty(mg, "uma", {
    get: function () {
      return wx.uma;
    }
  });
}();